<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use GeneaLabs\LaravelModelCaching\Traits\Cachable;


class Activity extends SortableModel
{
    use HasFactory;
    use Cachable;


    protected $fillable = [
        'title', 'banner', 'equity', 'describe', 'poster', 'order', 'qrcode'
    ];

    protected $casts = [
        'order' => 'integer',
    ];

    public function prizes()
    {
        return $this->hasMany(ActivityPrize::class)->where('valid', true)->orderBy('level', 'asc');
    }

    public function vehicles()
    {
        return $this->hasMany(Vehicle::class)->orderBy('order', 'desc');
    }
}
